from RandomList import GetRandomList

# 奇偶归并 可并行
def odd_even_merge_sort(arr):
    length = len(arr)
    while True:
        flag = True
        for i in range(1, length - 1, 2):
            if arr[i] > arr[i + 1]:
                arr[i], arr[i + 1] = arr[i + 1], arr[i]
                flag = False
        for i in range(0, length - 1, 2):
            if arr[i] > arr[i + 1]:
                arr[i], arr[i + 1] = arr[i + 1], arr[i]
                flag = False
        if flag:
            break



if __name__ == "__main__":
    Arr = GetRandomList(100)
    odd_even_merge_sort(Arr)
    print(Arr)
